/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package proyecto;

import java.awt.event.ActionListener;
import javax.swing.JFrame;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.util.*;
/**
 *
 * @author Samsung
 */
public class VRadioButtons extends JFrame implements ActionListener {
    
    private JPanel superior, envio, panel1, panel2, panel3, panel4, panel5, panel6, panel7, panel8;
    private JButton nuevo, atras, edit1, edit2, edit3, edit4, edit5, edit6, edit7, edit8;
    private JLabel titulo, recomendacion, lPreg1;
    private JRadioButton Preg1, preg2, preg3, preg4, preg5, preg6, preg7, preg8;
    private ArrayList respuestas;
    private ArrayList<JPanel> preguntas;
    private TextField tp1, tp2, tp3, tp4, tp5, tp6, tp7, tp8;
    private int aux=1;
       
    
    public VRadioButtons()
    {
        this.setSize(700, 700);
        this.setLayout(new GridLayout(9,1));
        this.setTitle("Ventada de verdadero o falso");
         this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        
        
        ArrayList<JPanel> preguntas = new ArrayList<JPanel>();
        
        JPanel superior = new JPanel();
        JPanel panel1 = new JPanel();
        
        
        JButton nuevo = new JButton("nuevo");
        JButton atras = new JButton("atras");
        JButton edit1 = new JButton("editar");
        
        
        JLabel recomendacion = new JLabel("Seleccione la casilla si la respuesta es afirmativa");
        
        JRadioButton preg1 = new JRadioButton("Ingrese su pregunta");
        
        superior.setLayout(new FlowLayout());
        superior.add(nuevo);
        superior.add(atras);
        superior.add(recomendacion);
        
        panel1.add(preg1);
        panel1.add(edit1);
        
        preguntas.add(panel1);
       
        
        
        JPanel panel2 = new JPanel();
            
            JButton edit2 = new JButton("editar");
            
            JRadioButton preg2 = new JRadioButton("Ingrese su pregunta");
            
            panel2.add(preg2);
            panel2.add(edit2);
            
            panel2.setVisible(false);
            
        preguntas.add(panel2);
            
        JPanel panel3 = new JPanel();
            
            JButton edit3 = new JButton("editar");
            
            JRadioButton preg3 = new JRadioButton("Ingrese su pregunta");
            
            panel3.add(preg3);
            panel3.add(edit3);
            
            panel3.setVisible(false);
            
             preguntas.add(panel3);
            
        JPanel panel4 = new JPanel();
            
            JButton edit4 = new JButton("editar");
            
            JRadioButton preg4 = new JRadioButton("Ingrese su pregunta");
            
            panel4.add(preg4);
            panel4.add(edit4);
            
            panel4.setVisible(false);
            
             preguntas.add(panel4);
            
        JPanel panel5 = new JPanel();
            
            JButton edit5 = new JButton("editar");
            
            JRadioButton preg5 = new JRadioButton("Ingrese su pregunta");
            
            panel5.add(preg5);
            panel5.add(edit5);
            
            panel5.setVisible(false);
            
             preguntas.add(panel5);
            
        JPanel panel6 = new JPanel();
            
            JButton edit6 = new JButton("editar");
            
            JRadioButton preg6 = new JRadioButton("Ingrese su pregunta");
            
            panel6.add(preg6);
            panel6.add(edit6);
            
            panel6.setVisible(false);
            
             preguntas.add(panel6);
            
        JPanel panel7 = new JPanel();
            
            JButton edit7 = new JButton("editar");
            
            JRadioButton preg7 = new JRadioButton("Ingrese su pregunta");
            
            panel7.add(preg7);
            panel7.add(edit7);
            
            panel7.setVisible(false);
            
             preguntas.add(panel7);
            
        JPanel panel8 = new JPanel();
            
            JButton edit8 = new JButton("editar");
            
            JRadioButton preg8 = new JRadioButton("Ingrese su pregunta");
            
            panel8.add(preg8);
            panel8.add(edit8);
            
            panel8.setVisible(false);
            
             preguntas.add(panel8);
            
        this.getContentPane().add(superior);
        this.getContentPane().add(preguntas.get(0));
        this.getContentPane().add(preguntas.get(1));
        this.getContentPane().add(preguntas.get(2));
        this.getContentPane().add(preguntas.get(3));
        this.getContentPane().add(preguntas.get(4));
        this.getContentPane().add(preguntas.get(5));
        this.getContentPane().add(preguntas.get(6));
        this.getContentPane().add(preguntas.get(7));
        
        
        
        nuevo.addActionListener(this);
        atras.addActionListener(this);
        
        
        preg1.setText("probando probando 123");
    }

    
    public void actionPerformed(ActionEvent e) {
        
        if(e.getSource() == nuevo)
        {
            recomendacion.setText("hola mundo");
            
            preguntas.get(aux).setVisible(true);
            aux++;
            
        }
        
        if(e.getSource() == atras)
        {
            recomendacion.setText("hola mundo");
            
        }
    }
    
    
}
